package cn.xerllent.config;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WorkerConfig {

	/**
	 * 线程池之单线程执行队列
	 * 声明的方法就是bean的名称,注解引用时注意通过@Autowired和@Qualifier("singleThreadExecutor")结合使用，可以注入指定名称的bean
	 * */
    @Bean
    public ExecutorService singleThreadExecutor() {
    	return Executors.newSingleThreadExecutor();
    }
}
